package com.zhoug.demo.push;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.zhoug.common.utils.JsonUtils;
import com.zhoug.logging.Logger;
import com.zhoug.push.core.PushMessage;

/**
 * 定义消息接受广播接受者 统一处理各个厂商的消息
 * @description: 类的简要描述
 * @author: 35574
 * @date: 2025/11/6 9:38
 */
public class PushMessageReceiver extends BroadcastReceiver {
    private static final String TAG = ">>>PushMessageReceiver";
    public static final String ACTION_MESSAGING = "com.zhoug.push.MESSAGING_EVENT";

    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if(ACTION_MESSAGING.equals(action)){
            PushMessage message= intent.getParcelableExtra("message");
            String packageName= intent.getStringExtra("sendPackageName");
            Logger.d(TAG, "onReceive:message: "+ JsonUtils.toJson(message));
            Logger.d(TAG, "onReceive:sendPackageName: "+packageName);
        }
    }

}
